public class Solution198 {
    public int rob(int[] nums) {
        int a, b, c, m;
        a = b = c = 0;
        for (int num : nums) {
            m = Math.max(a, b) + num;
            a = b;
            b = c;
            c = m;
        }
        return Math.max(b, c);
    }
}
